|
|
|
|
|
|
|
Figure 20.1
The Class Builder utility. |
|
|
|
|
|
|
|
|
A method of a class is a Public Sub or Public Function created in the CLS file. A method is simply a subroutine or function that you would normally see in a BAS file, but instead its tied to the object. These methods generally perform some operation on the data contained within the class. They may or may not return a value from the object. This will be determined by whether you write a sub or a function for the method name. |
|
|
|
|
|
|
|
|
Lets write a method for the Employee class that returns a string showing the employees name in a last name, first name format. To accomplish this, you need to create a new Public Sub called EmployeeName in the CLS file. |
|
|
|
|
| Creating a Method 1. Create a new Public Sub in the Employee class module, as shown in the following code: | | Public Sub EmployeeName()
Dim strMsg As String
strMsg = "Employee Name: " & mstrLastName & _ |
|
|
|